/*******************************************************************************
 * This file is part of blueprint4j www.blueprint4j.org.
 * 
 *     blueprint4j is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU Lesser General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     blueprint4j is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU Lesser General Public License for more details.
 * 
 *     You should have received a copy of the GNU Lesser General Public License
 *     along with blueprint4j. If not, see <http://www.gnu.org/licenses/>.
 ******************************************************************************/
package blueprint4j.comm;


import blueprint4j.utils.*;
/*
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;*/
import java.io.File;

/**
 * This class serves as a wrapper class to send and receive email
 */
public class Tester {

	/*
	private Message mail = null;
	private Multipart mail_parts = new MimeMultipart();

	public Tester() {}

	/**
	 * Instantiate an email
	 */
	public Tester(String p_smtp_host,
	             String p_address,
	             String p_from,
	             String p_cc,
	             String p_subject_line,
	             String p_message)
	throws BindException {
		/*
		try {
			Properties props = System.getProperties();
			props.put("mail.smtp.host", p_smtp_host);
			Session session = Session.getDefaultInstance(props, null);
			mail = new MimeMessage(session);
			mail.setFrom(new InternetAddress(p_from));
			mail.setRecipients(Message.RecipientType.TO, InternetAddress.parse(p_address, false));
			if (p_cc != null) {
				mail.setRecipients(Message.RecipientType.CC, InternetAddress.parse(p_cc, false));
			}
			if (p_subject_line != null) {
				mail.setSubject(p_subject_line);
			}
			MimeBodyPart mbp = new MimeBodyPart();
			mbp.setText(p_message);
			mail_parts.addBodyPart(mbp);
		} catch (Throwable throwable) {
			throw new BindException(throwable);
		}
		*/
	}

	public Tester(String p_address,
	             String p_from,
	             String p_cc,
	             String p_subject_line,
	             String p_message)
	throws BindException {
		/*
		this(
		    Settings.getString("email.smtp_host","localhost"),
		    p_address,
		    p_from,
		    p_cc,
		    p_subject_line,
		    p_message
		);
		*/
	}

	public void addAttachment(File attach)
	throws BindException {
		/*
		try {
			MimeBodyPart mbp = new MimeBodyPart();
			FileDataSource fds = new FileDataSource(attach.getAbsolutePath());
			mbp.setDataHandler(new DataHandler(fds));
			mbp.setFileName(attach.getName());
			mail_parts.addBodyPart(mbp);
		} catch (Throwable throwable) {
			throw new BindException(throwable);
		}
		*/
	}

	public void send()
	throws BindException {
		/*
		try {
			mail.setContent(mail_parts);
			mail.setSentDate(new Date());
			// send the thing off
			Transport.send(mail);
		} catch (Throwable throwable) {
			throw new BindException(throwable);
		}
		*/
	}
}
